/*
 * Copyright (c) 2009 - Jim Lehmer
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 * You may contact the author at jim [dot] lehmer [at] gmail [dot] com.
 */ 

USE IISLogs -- Change to match the database in which you have LogParser parsing the SharePoint IIS logs.
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.LogTable') AND type in (N'U'))
DROP TABLE dbo.LogTable
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE dbo.LogTable
(
	LogFilename varchar(255) NULL,
	LogRow int NULL,
	date datetime NULL, -- Put an index on this for better query performance
	time datetime NULL,
	cIp varchar(255) NULL,
	csUsername varchar(255) NULL,
	sSitename varchar(255) NULL,
	sComputername varchar(255) NULL,
	sIp varchar(255) NULL,
	sPort int NULL,
	csMethod varchar(255) NULL,
	csUriStem varchar(255) NULL, -- Put an index on this for better query performance
	csUriQuery varchar(255) NULL,
	scStatus int NULL,
	scSubstatus int NULL,
	scWin32Status int NULL,
	scBytes int NULL,
	csBytes int NULL,
	timeTaken int NULL,
	csVersion varchar(255) NULL,
	csHost varchar(255) NULL,
	csUserAgent varchar(255) NULL,
	csCookie varchar(255) NULL,
	csReferer varchar(255) NULL,
	sEvent varchar(255) NULL,
	sProcessType varchar(255) NULL,
	sUserTime real NULL,
	sKernelTime real NULL,
	sPageFaults int NULL,
	sTotalProcs int NULL,
	sActiveProcs int NULL,
	sStoppedProcs int NULL
) ON PRIMARY

GO

SET ANSI_PADDING OFF
GO


